<!-- directive:title AngularJS $templateCache 服务 -->
<!-- directive:breadcrumb AngularJS $templateCache 服务 -->
<div class='panel-body'>
    <article class="docs-content">
        <h3>哈哈哈(⊙o⊙)…♪(^∇^*)</h3>
        <script type="text/xianjs" ui-bs>
            app.controller('myCtrl', ['$scope','$templateCache', function($scope,$templateCache){
               var tmp = '<h4>hello</h4>'
                     + '<p>这是直接调用$templateCache服务获取模板文件的方式</p>'
                     + '<a href="http://www.baidu.com">服务启用templateCache方式</a>';
               $templateCache.put('hello.html',tmp);
           }])
            app.controller('myCtrl', function($templateCache,$sce) {
                var tpl = $templateCache.get('templateId.html');
                tpl = $sce.trustAsHtml(tpl);
                this.text = tpl;
            });
        </script>
        <p>$templateCache基于cacheFactory，接口保持一致，方法主要有：</p>
        <table class="table">
            <tr> <td>put</td> <td>向内存写入模板内容</td> </tr>
            <tr> <td>get</td> <td>从内存获取模板内容</td> </tr>
            <tr> <td>remove</td> <td>传入key值，删除对应模板内容</td> </tr>
            <tr> <td>removeAll</td> <td>删除所有模板内容</td> </tr>
            <tr> <td>destroy</td> <td>解除key-value对应关系，但不释放内存</td> </tr>
            <tr> <td>info</td> <td>模板缓存对象的信息</td> </tr>
        </table>
        <button class="btn btn-danger" ng-click="do1()">do1</button>
        <button class="btn btn-success" ng-click="do2()">do2</button>
        <button class="btn btn-info" ng-click="do3()">do3</button>
    </article>
    <div>time = {{time}}</div>
    <div>tpl = {{tpl}}</div>
</div>
